package demo1;

import java.util.Objects;

class Student {
    public String id;

    public Student(String id) {
        this.id = id;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Student student = (Student) o;
        return Objects.equals(id, student.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }
}

public class Test {
    public static void main(String[] args) {
        Student student1 = new Student("1234");
        Student student2 = new Student("12345");
        Student student3 = new Student("123456");
        Student student4 = new Student("123457");
        HashBuck2<Student,Integer> hashBuck2 = new HashBuck2();
        hashBuck2.put(student1,1);
        hashBuck2.put(student2,2);
        hashBuck2.put(student3,3);
        hashBuck2.put(student4,4);
        System.out.println(hashBuck2.getValue(student1));
        System.out.println(hashBuck2.getValue(student2));
        System.out.println(hashBuck2.getValue(student3));
        System.out.println(hashBuck2.getValue(student4));
    }
}
